Skip to content

생활관 미지정 질문의 생활관별 검색 개선#39

Merged
1024andrew merged 1 commit into
devfrom
fix/#35
May 5, 2026
Merged

생활관 미지정 질문의 생활관별 검색 개선#39
1024andrew merged 1 commit into
devfrom
fix/#35

Conversation

@1024andrew

@1024andrew 1024andrew commented May 5, 2026

Copy link
Copy Markdown
Contributor

유형

  • Feat
  • Fix
  • Design
  • Docs
  • Chore
  • Hotfix

변경 사항

  • dormitory = null 상태에서 생활관별 시설/현황 질문이 들어오면 제1·제2·제3학생생활관을 각각 검색하도록 개선했습니다.
  • 기존 전체 검색 방식에서는 상위 top_k 안에 특정 생활관 정보가 포함되지 않아 답변에서 일부 생활관 정보가 누락될 수 있었습니다.
  • 생활관별 검색 시 각 생활관마다 후보 chunk를 여러 개 가져온 뒤, 해당 생활관과 관련성이 높은 chunk를 우선 선택하도록 정렬 로직을 추가했습니다.
  • 공통 팁 문서가 여러 생활관 검색에서 반복적으로 선택되어 최종 검색 결과가 하나만 남는 문제를 방지했습니다.

수정 배경

dormitory = null 상태에서 휴게실에 뭐 있어?처럼 전체 생활관 정보를 묻는 질문을 했을 때, 특정 생활관 정보가 검색 결과에서 누락되거나 공통 팁 문서만 선택되는 문제가 있었습니다.

예를 들어 제1·제2·제3학생생활관에 각각 휴게실 정보가 존재하더라도, 전체 검색 결과 상위 chunk에 일부 생활관 정보만 포함되면 답변도 일부 생활관 기준으로만 생성되었습니다.

이를 개선하기 위해 생활관별 시설/현황 질문에 대해서는 전체 검색에만 의존하지 않고, 각 생활관별 검색 결과를 합쳐 답변 생성에 사용하도록 수정했습니다.

테스트

  • 휴게실에 뭐 있어? + dormitory = null
  • 다리미 있어? + dormitory = null
  • 기숙사 수용인원 몇명이야? + dormitory = null

기대 효과

  • 생활관 미지정 질문에서 특정 생활관 정보가 누락되는 문제 완화
  • 생활관별 시설/현황 정보를 더 균형 있게 안내 가능
  • 공통 문서가 반복 선택되어 최종 chunk가 부족해지는 문제 방지
  • 단순히 전체 검색 top_k를 늘리지 않고 필요한 질문에서만 생활관별 검색 수행

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the dormitory search logic by introducing a custom scoring function to prioritize official sources and dormitory matches, while also increasing the initial search depth. Feedback highlights that debug print statements should be removed or replaced with proper logging, and the '탕비실' (pantry) keyword, which was inadvertently removed from the search triggers, should be restored.

Comment on lines +426 to +427
print("should each dorm:", _should_search_each_dormitory(question))
print("question:", question)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

디버깅을 위한 print 문이 포함되어 있습니다. 운영 환경에서는 logging 모듈을 사용하거나 해당 구문을 제거하는 것이 좋습니다.

Comment on lines +447 to +456
print("===== FINAL EACH DORMITORY CHUNKS =====")
print("chunks_count:", len(chunks))
for index, chunk in enumerate(chunks, start=1):
print(
index,
chunk.get("document_id"),
chunk.get("dormitory"),
chunk.get("similarity"),
chunk.get("source"),
(chunk.get("content") or "")[:300],
(chunk.get("content") or "")[:200],
)
print("================================")
print("======================================")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

디버깅용 출력 코드가 남아 있습니다. 불필요한 표준 출력을 방지하기 위해 제거하거나 로거를 사용하도록 수정해 주세요.

Comment on lines +902 to +914
DORMITORY_SPECIFIC_SEARCH_TRIGGERS = [
"휴게실",
"다리미",
"편의점",
"전자레인지",
"전자렌지",
"정수기",
"세탁실",
"수용인원",
"몇명",
"몇명수용",
"호실수",
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

DORMITORY_SPECIFIC_SEARCH_TRIGGERS 리스트에서 기존에 존재하던 "탕비실" 키워드가 누락되었습니다. 의도적인 삭제가 아니라면 다시 추가하는 것이 좋습니다.

@1024andrew 1024andrew merged commit 6a47f98 into dev May 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant